<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var arr1 = [1,2,3]
        // arr1.push(4)
        console.log(arr1);
        var arr2 = [4,5,6]
        // arr2.unshift(0) // 前
        console.log(arr2);

       arr1.unshift ()  // 前
       console.log(arr1);

       arr2.pop()  // 后
       console.log(arr2);

       console.log(arr1.indexOf(5));
       

       console.log(arr2.lastIndexOf(5));

       var arr3 = arr1.concat(arr2)
       console.log(arr3);

       var arr4 = [...arr1 , ...arr2]
       console.log(arr4);


       console.log(arr3.toString());
       
       console.log(arr3.join('-'));  



       arr4.slice(2,4)  // 返回被删除的元素

       var  arr8 = arr4.slice(2,4)
       console.log(arr8);



       // 可实现数组的增删改
       arr4.splice(2,2,8,9,0,1,2)
       console.log(arr4);
       
    </script>
</body>
</html>